package com.ruoyi.firefighter.controller;

import com.ruoyi.award.domain.FirefighterAward;
import com.ruoyi.award.service.IFirefighterAwardService;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.domain.entity.SysUser;
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.common.exception.ServiceException;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.disease.domain.FirefighterDisease;
import com.ruoyi.disease.service.IFirefighterDiseaseService;
import com.ruoyi.drill.domain.FirefighterDrill;
import com.ruoyi.drill.service.IFirefighterDrillService;
import com.ruoyi.emergency.domain.FirefighterEmergency;
import com.ruoyi.emergency.service.IFirefighterEmergencyService;
import com.ruoyi.enlistIand.domain.IfmEnlistIand;
import com.ruoyi.enlistIand.service.IIfmEnlistIandService;
import com.ruoyi.fireRescueRank.domain.IfmFireRescueRank;
import com.ruoyi.fireRescueRank.service.IIfmFireRescueRankService;
import com.ruoyi.firefighter.domain.FirefighterInfo;
import com.ruoyi.firefighter.service.IFirefighterInfoService;
import com.ruoyi.firefighterTrainingTable.domain.FirefighterTrainingTable;
import com.ruoyi.firefighterTrainingTable.service.IFirefighterTrainingTableService;
import com.ruoyi.ifmAge.domain.IfmAge;
import com.ruoyi.ifmAge.service.IIfmAgeService;
import com.ruoyi.ifmDepartmentTitle.domain.IfmDepartmentTitle;
import com.ruoyi.ifmDepartmentTitle.service.IIfmDepartmentTitleService;
import com.ruoyi.ifmEnlistIand.domain.FirefighterFireTable;
import com.ruoyi.ifmEnlistIand.service.IFirefighterFireTableService;
import com.ruoyi.ifmEnlistIand.service.ISysUserService;
import com.ruoyi.ifmPost.domain.IfmPost;
import com.ruoyi.ifmPost.service.IIfmPostService;
import com.ruoyi.ifmReward.domain.IfmReward;
import com.ruoyi.ifmReward.service.IIfmRewardService;
import com.ruoyi.imRank.domain.IfmRank;
import com.ruoyi.imRank.service.IIfmRankService;
import com.ruoyi.punishment.domain.FirefighterPunishment;
import com.ruoyi.punishment.service.IFirefighterPunishmentService;
import com.ruoyi.qualification.domain.FirefighterQualification;
import com.ruoyi.qualification.service.IFirefighterQualificationService;
import com.ruoyi.record.domain.FirefighterRecord;
import com.ruoyi.record.service.IFirefighterRecordService;
import com.ruoyi.security.domain.FirefighterSecurity;
import com.ruoyi.security.service.IFirefighterSecurityService;
import com.ruoyi.task.domain.FirefighterFireTask;
import com.ruoyi.task.service.IFirefighterFireTaskService;
import com.ruoyi.tournament.domain.FirefighterTournament;
import com.ruoyi.tournament.service.IFirefighterTournamentService;
import com.ruoyi.train.domain.FirefighterTrain;
import com.ruoyi.train.service.IFirefighterTrainService;
import com.ruoyi.vo.ExportFilter;
import com.ruoyi.vo.FirefighterDetailsDTO;
import com.ruoyi.vo.OptionsVo;
import com.ruoyi.workYear.domain.IfmWorkYear;
import com.ruoyi.workYear.service.IIfmWorkYearService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import javax.servlet.http.HttpServletResponse;
import java.util.*;
import java.util.stream.Collectors;

/**
 * 下拉框Controller
 *
 * @author ruoyi
 * @date 2024-09-27
 */
@Slf4j
@RestController
@RequestMapping("/system/everylast")
public class EverylastCommonController extends BaseController
{
    @Autowired
    private IFirefighterInfoService firefighterInfoService;

    @Autowired
    private IIfmAgeService ifmAgeService;

    @Autowired
    private IIfmDepartmentTitleService ifmDepartmentTitleService;

    @Autowired
    private IIfmEnlistIandService ifmEnlistIandService;

    @Autowired
    private IIfmFireRescueRankService ifmFireRescueRankService;

    @Autowired
    private IIfmPostService ifmPostService;

    @Autowired
    private IIfmRankService ifmRankService;

    @Autowired
    private IIfmRewardService ifmRewardService;

    @Autowired
    private IIfmWorkYearService ifmWorkYearService;

    @Autowired
    private IFirefighterFireTaskService firefighterFireTaskService;

    @Autowired
    private IFirefighterQualificationService firefighterQualificationService;

    @Autowired
    private IFirefighterTrainService firefighterTrainService;

    @Autowired
    private IFirefighterPunishmentService firefighterPunishmentService;

    @Autowired
    private IFirefighterTrainingTableService firefighterTrainingTableService;

    @Autowired
    private IFirefighterFireTableService firefighterFireTableService;

    //年龄
    @GetMapping("/selectAge")
    public List<OptionsVo> selectAge(IfmAge ifmAge) {
        List<IfmAge> list = ifmAgeService.selectIfmAgeList(ifmAge);
        List<OptionsVo> ifmAgeList = list.stream()
                .map(hw -> new OptionsVo(hw.getAgeKey(), hw.getAgeName()))
                .collect(Collectors.toList());
        return ifmAgeList;
    }
    //查询部职别列表
    @GetMapping("/selectDepartment")
    public List<OptionsVo> selectDepartment(IfmDepartmentTitle ifmDepartmentTitle) {
        List<IfmDepartmentTitle> list = ifmDepartmentTitleService.selectIfmDepartmentTitleList(ifmDepartmentTitle);
        List<OptionsVo> ifmAgeList = list.stream()
                .map(hw -> new OptionsVo(hw.getTitleKey(), hw.getTitleName()))
                .collect(Collectors.toList());
        return ifmAgeList;
    }

    //查询入伍（队）地列表
    @GetMapping("/selectEnlistIand")
    public List<OptionsVo> selectEnlistIand(IfmEnlistIand ifmEnlistIand) {
        List<IfmEnlistIand> list = ifmEnlistIandService.selectIfmEnlistIandList(ifmEnlistIand);
        List<OptionsVo> ifmAgeList = list.stream()
                .map(hw -> new OptionsVo(hw.getIandKey(), hw.getIandName()))
                .collect(Collectors.toList());
        return ifmAgeList;
    }

    //查询消防救援衔列表
    @GetMapping("/selectRescueRank")
    public List<OptionsVo> selectRescueRank(IfmFireRescueRank ifmFireRescueRank) {
        List<IfmFireRescueRank> list = ifmFireRescueRankService.selectIfmFireRescueRankList(ifmFireRescueRank);
        List<OptionsVo> ifmAgeList = list.stream()
                .map(hw -> new OptionsVo(hw.getRescueRankKey(), hw.getRescueRankName()))
                .collect(Collectors.toList());
        return ifmAgeList;
    }

    //查询工作岗位列表
    @GetMapping("/selectIfmPost")
    public List<OptionsVo> selectIfmPost(IfmPost ifmPost) {
        List<IfmPost> list = ifmPostService.selectIfmPostList(ifmPost);
        List<OptionsVo> ifmAgeList = list.stream()
                .map(hw -> new OptionsVo(hw.getPostKey(), hw.getPostName()))
                .collect(Collectors.toList());
        return ifmAgeList;
    }

    //查询职级列表
    @GetMapping("/selectIfmRank")
    public List<OptionsVo> selectIfmRank(IfmRank ifmRank) {
        List<IfmRank> list = ifmRankService.selectIfmRankList(ifmRank);
        List<OptionsVo> ifmAgeList = list.stream()
                .map(hw -> new OptionsVo(hw.getRankKey(), hw.getRankName()))
                .collect(Collectors.toList());
        return ifmAgeList;
    }

    //查询奖励列表
    @GetMapping("/selectIfmReward")
    public List<OptionsVo> selectIfmReward(IfmReward ifmReward) {
        List<IfmReward> list = ifmRewardService.selectIfmRewardList(ifmReward);
        List<OptionsVo> ifmAgeList = list.stream()
                .map(hw -> new OptionsVo(hw.getRewardKey(), hw.getRewardName()))
                .collect(Collectors.toList());
        return ifmAgeList;
    }

    //查询工作年限列表
    @GetMapping("/selectIfmWorkYear")
    public List<OptionsVo> selectIfmWorkYear(IfmWorkYear ifmWorkYear) {

        List<IfmWorkYear> list = ifmWorkYearService.selectIfmWorkYearList(ifmWorkYear);
        List<OptionsVo> ifmAgeList = list.stream()
                .map(hw -> new OptionsVo(hw.getWorkKey(), hw.getWorkName()))
                .collect(Collectors.toList());
        return ifmAgeList;
    }





}
